<?php
include_once 'common.func.php';

function isLogin()
{
    return (isset($_SESSION) && isset($_SESSION['user'])) ? true : false;
}

function checkLogin()
{
    if ($_SERVER['REMOTE_ADDR'] != '61.172.204.9' && $_SERVER['REMOTE_ADDR'] != '127.0.0.1') {
        exit('ip deny');
    }
    if (!session_start()) {
        exit('session start failed');
    }
    if (!isLogin()) {
        header('Location: index.php');
    }
}
//test
//$is = isLogin();
//var_dump($is);
